<?php require VIEW_PATH.'/header.php';?>
<body>
<div class="hd-menu-list">
    <ul>
        <li class="active">
        	<a href="#">库存管理</a>
        </li>
        <li><a href="{{U('add',array('goods_id'=>$good))}}">新品入库</a></li>
        <li>
        <span style="font-weight: bold;">
            <lable style="color:red;">*&nbsp;温馨提示</lable>，你可以根据货品实际情况，点击当前框修改货存</span>
        </li>
    </ul>
</div>
<table class="hd-table hd-table-list">
    <thead>
    <tr style="text-align: center">
        <td>编号</td>
        <?php foreach ($attrTitle as $v):?>
        <td>{{$v['attr_name']}}</td>
        <?php endforeach;?>
        <td>货号</td>
        <td>库存</td>
        <td>操作</td>
    </tr>
    </thead>
    <tbody>
    <?php foreach($data as $key=>$value):?>
    <tr style="text-align: center">
        <td>
            {{$value['id']}}
        </td>
        <td>
            {{$value['color_value']}}
        </td>
        <td>
           {{$value['size_value']}} 
        </td>
        <td>
            {{$value['goods_sn']}}
        </td>
        <td style="width: 300px;">
            <input type="hidden" name="id" value="{{$value['id']}}">
            <input name="store_num" style="text-align: center;width:100px;" type="text" value="{{$value['store_num']}}">
        </td>
        <td class="hd-w150">
            <a href="#">删除</a> 
        </td>
    </tr>
<?php endforeach;?>
    </tbody>
</table>
</body>
<!-- 当前页直接修改库存 -->
<script type="text/javascript">
    $('[name=store_num]').change(function(){
        var storeId = $(this).parent().find('[name=id]').val();
        var postData = {id:storeId,store_num:$(this).val()};
        $.post("{{U('edit')}}",postData,function(data){
            hd_alert({
                message: data.message,//显示内容
                timeout: 3,//显示时间
            });
        });
    }); 
</script>
<!-- 当前页直接修改库存end -->
</html>